<template>
  <view>
    <z-paging
      ref="paging"
      style="padding-bottom: 80rpx"
      v-model="dataList"
      :safe-area-inset-bottom="true"
      :auto-show-back-to-top="true"
      :use-page-scroll="false"
      @query="queryList"
    >
      <view class="item margin-bottom-sm bg-white" v-for="(item, index) in dataList" :key="index">
        <view class="cu-bar bg-white padding-xs solid-bottom flex justify-between" style="min-height: unset">
          <view class="text-df margin-xs">
            <text class="cuIcon-time"></text>
            {{ item.addtime }}
          </view>
        </view>
        <view class="grid col-3 padding-xs dishe margin-bottom-xs">
          <view class="text-center text-sm">
            <view class="margin-xs text-gray">订单类型</view>
            <view>{{ item.type }}</view>
          </view>
          <view class="text-center text-sm">
            <view class="margin-xs text-gray">变动金额</view>
            <view class="text-price text-green text-lg" v-if="item.price > 0">{{ parseFloat(item.price).toFixed(2) }}</view>
            <view class="text-price text-red text-lg" v-else>{{ parseFloat(item.price).toFixed(2) }}</view>
          </view>
          <view class="text-center text-sm">
            <view class="margin-xs text-gray">变动后账户余额</view>
            <view class="text-price text-blue">{{ parseFloat(item.money).toFixed(2) }}</view>
          </view>
        </view>
        <view class="grid padding-sm text-orange text-sm solid-bottom">
          <text class="text-gray">备注：</text>
          {{ item.data }}
        </view>
        <view class="grid padding-sm text-orange text-sm">关联订单：{{ item.orderno }}</view>
      </view>
      <v-footer :bgColor="bgC" tab="my" class="buttonmenu" slot="bottom"></v-footer>
    </z-paging>
    <v-popup @update:isShow="isShow = $event" :isShow="isShow"></v-popup>
    <!-- #ifdef MP-WEIXIN -->
    <v-kefu @tap="tokefu()"></v-kefu>
    <!-- #endif -->
    <!-- #ifndef MP-WEIXIN -->
    <view @click="tokefu()" class="">
      <v-kefu></v-kefu>
    </view>
    <!-- #endif -->
  </view>
</template>

<script>
import footer from '@/components/footer.vue';
import kefu from '@/components/kefu.vue';
import popup from '@/components/popup.vue';
export default {
  components: { 'v-footer': footer, 'v-popup': popup, 'v-kefu': kefu },
  data() {
    return {
      isShow: 0, //控制客服弹出层
      dataList: [],
      bgC: false
    };
  },
  onShow() {
    var that = this;
    this.bgC = that.app.background;
  },
  methods: {
    tokefu() {
      this.isShow = !this.isShow;
    },
    queryList(pageNo, pageSize) {
      const params = {
        pageNo: pageNo,
        pageSize: pageSize,
        type: this.TabCura
      };
      var that = this;
      uni.request({
        method: 'post',
        url: that.app.apiHost + '/memberlog',
        header: { Authorization: 'bearer ' + that.app.getAuthCode() },
        data: params,
        success: (data) => {
          let list = data.data.data.data;
          console.log(list);
          that.$refs.paging.complete(list);
        },
        fail(a) {
          that.$refs.paging.complete(false);
        }
      });
    }
  }
};
</script>

<style>
page {
  background-color: #f1f1f1;
}

.dishe {
  border-top: #e5e5e5 1px dashed;
  border-bottom: #e5e5e5 1px dashed;
  background-color: #f0fddd;
}
</style>
